<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="<c:url value='/css/style.css'/>" rel="stylesheet" type="text/css"/>
<fmt:setBundle basename="Messages_en" />
<title><fmt:message key="title.staff"/></title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://jzaefferer.github.com/jquery-validation/jquery.validate.js"></script>
<script type="text/javascript">
  $(document).ready(function(){
    $("#searchID").validate();
  });
</script>
</head>
<body>
<%@ include file="header.jsp" %>
<table>
<tr>
<td width=15%></td>
<td class="menuborder" width=20%>
<table id="head">
			<tr>
<!-- 				<td><h2 id="header">ISS Facilities Booking</h2></td> -->
				<td>
<!-- 				<input type="hidden" name="welcome" id="show_greeting" /> -->
				<c:if test="${!empty sessionScope.LoggedinUser.username}">
				<h5>Welcome ${sessionScope.LoggedinUser.username}</h5>
				</c:if>
				</td>
			</tr>
		</table>
		<table id="content">
			<tr>
				<td><h2 id="header">MENU</h2></td>
			</tr>
			<tr>
				<td><a href="MakeABooking.jsp">Make a Booking</a></td>
			</tr>
			<tr>
				<td><a href="BookDetailsController">View Booking Details</a></td>
			</tr>
			<tr>
				<td><a href="BookingHistoryController">View Booking History</a></td>
			</tr>
			<tr>
				<td><a href="ManageStaff.jsp">Manage Staff</a></td>
			</tr>
			<tr>
				<td><a href="LoadFacility">Manage Facilities</a></td>
			</tr>
			<tr>
				<td><a href="Login.jsp">Sign Out</a>
				</td>
			</tr>
		</table>
</td>
<td class=2%></td>
<td width=53%>
	<h2 id="headtwo"><fmt:message key="label.user"/></h2>
	<c:url var="url" scope="page" value="/SetupStaff.jsp">
        		<c:param name="username" value=""/>
        		<c:param name="role" value=""/>
                <c:param name="contactNo" value=""/>
                <c:param name="email" value=""/>
                <c:param name="reportTo" value=""/>               
                <c:param name="insert" value="true"/>
        </c:url>
	<a href="${url}"><fmt:message key="label.user.add"/></a>	
<form action="/JavaCA/staffsearch" method=post id="searchID">
<table cellpadding=4 cellspacing=2 border=0>
<tr>
<td class="positionleft"><fmt:message key="setup.id" /></td>
<td class="positionleft"><input type="text" name="userId" value="${param['userId']}" size=15 maxlength=8 class="required digits"></td>
<td class="positionleft"><input type="submit" value="Search"></td>
</tr>
</table>
</form>
<table cellpadding=4 class="border">
	<c:if test="${!empty staff && staff.userId!=0}">
	<tr>
		<th class="border"><fmt:message key="setup.staff.id" /></th>
		<th class="border"><fmt:message key="setup.staff.name" /></th>
		<th class="border"><fmt:message key="setup.staff.role" /></th>
		<th class="border"><fmt:message key="setup.staff.contact" /></th>
		<th class="border"><fmt:message key="setup.staff.email" /></th>
		<th class="border"><fmt:message key="setup.staff.report" /></th>
		<th></th>
	</tr>
		<tr>
			<td class="border">${staff.userId}</td>
			<td class="border">${staff.username}</td>
			<td class="border">${staff.role}</td>
			<td class="border">${staff.contactNo}</td>
			<td class="border">${staff.email}</td>
			<td class="border">${staff.reportTo}</td>
			<td>
            <c:url var="updurl" scope="page" value="/SetupStaff.jsp">
            	   <c:param name="userId" value="${staff.userId}"/>
                   <c:param name="username" value="${staff.username}"/>
                   <c:param name="role" value="${staff.role}"/>
                   <c:param name="contactNo" value="${staff.contactNo}"/>
                   <c:param name="email" value="${staff.email}"/>
                   <c:param name="reportTo" value="${staff.reportTo}"/>
                   <c:param name="update" value="true"/>
            </c:url>
            <a href="${updurl}"><fmt:message key="label.user.edit"/></a>
                        &nbsp;&nbsp;
            <c:url var="delurl" scope="page" value="/deleteStaff">
                   <c:param name="userId" value="${staff.userId}"/>
            </c:url>
            <a href="${delurl}"><fmt:message key="label.user.delete"/></a>
            </td>
		</tr>
		</c:if>
</table>
<c:if test="${staff.userId==0}">
<table>
		<tr>
		<td class="errormsg">The searched ID does not exist.</td>
		</tr>
		</table>
</c:if>
</td>
<td width=10%></td>
</tr>
</table>
<%@ include file="footer.jsp" %>
</body>
</html>